package com.qww.test18;

/**
 * @author qww
 * @date 2021-04-05 19:14
 */
public class Test18 {
    public static void main(String[] args) {
        // 可变参数列表必须是String类型
        printArr(1, "asdf", "jkl;");
        // 也可以不传入可变长参数
        printArr(111);

    }

    public static void printArr(int a, String... args) {
        System.out.println("a=" + a);
        for (Object obj : args) {
            System.out.print(obj + " ");
        }
        System.out.println();
        System.out.println("length: " + args.length);
    }
    /*
    // Vararg parameter must be the last in the list
    public static void f(String... args, int a) {
    }
    */
}
